<?php
  require_once('scripts/restrict_access.php');
?> 
<?php //require_once('scripts/calculate_path.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--

Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Title      : Complimentary
Version    : 1.0
Released   : 20080409
Description: A two-column, fixed-width and lightweight template ideal for 1024x768 resolutions. Suitable for blogs and small websites.

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Complimentary by Free Css Templates</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="CSS/ComplementaryDefault.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<!-- start header -->
<div id="header">
<div id="logo">
    <h1><a href="#">Find-it</a> </h1>
  </div>
</div>
<!-- end header -->
<!-- start page -->
<div id="page"> 
  <!-- start content -->
  <div id="content">
    <div class="post">
      <p><br />
      </p>
        <h1 class="title">&nbsp;</h1>
      <h1 class="title">Items ordered by container</h1>

<?php 
	       $sql = 'SELECT itemName, itemId,containerId FROM `items` WHERE `accountId`= ? ORDER BY containerId';
		   $result = $dbRead->fetchAll($sql,$_SESSION['accountId']);
		   $size_of_result = sizeof($result); ?>
           
<?php 
	       $SQL = 'SELECT id,name,dbId,parentId FROM `containers` WHERE `accountId`= ? ORDER BY id';
		   $RESULT = $dbRead->fetchAll($SQL,$_SESSION['accountId']);
		   $size_of_RESULT = sizeof($RESULT); ?>           
           
<table width="100%" border="0">
	<tr>
          <td><h3 align="center"><strong>Items</strong></h3></td>
          <td><h3 align="center"><strong>Container</strong></h3></td>
        </tr>
	<?php
		  	for ($i=0;$i<$size_of_result;$i++){
		  ?>
        <tr>
          <td width="25%"><div align="left"><?php echo $result[$i]['itemName']; ?></div></td>
          <td width="25%"><div align="left"><?php echo $RESULT[($result[$i]['containerId'])-1]['name']; ?></td>
          </tr>
          
        <?php } ?>
      </table>
      <!-- The bottomSpace div is for reserving space at the bottom for the footer -->
        <div class="bottomSpace">
          <p><br /><br />
          </p>
        </div>
    </div>
  </div>
  <!-- end content --> 
  <!-- start sidebar --><!-- end sidebar -->
  <div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
<!-- start footer -->
<div id="footer">
  <p id="legal">(c) 2012 Find-It. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.<br />
	</p>
</div>
<!-- end footer -->
</body>
</html>
